<template>
  <div>
    <CloudButton type="primary" @click="showDrawer"> Open </CloudButton>
    <CloudDrawer
      title="Multi-level drawer"
      width="520"
      :closable="false"
      :visible="visible"
      @close="onClose"
    >
      <CloudButton type="primary" @click="showChildrenDrawer"> Two-level drawer </CloudButton>
      <CloudDrawer
        title="Two-level Drawer"
        width="320"
        :closable="false"
        :visible="childrenDrawer"
        @close="onChildrenDrawerClose"
      >
        <CloudButton type="primary" @click="showChildrenDrawer">
          This is two-level drawer
        </CloudButton>
      </CloudDrawer>
      <div
        :style="{
          position: 'absolute',
          bottom: 0,
          width: '100%',
          borderTop: '1px solid #e8e8e8',
          padding: '10px 16px',
          textAlign: 'right',
          left: 0,
          background: '#fff',
          borderRadius: '0 0 4px 4px',
        }"
      >
        <CloudButton style="marginright: 8px" @click="onClose"> Cancel </CloudButton>
        <CloudButton type="primary" @click="onClose"> Submit </CloudButton>
      </div>
    </CloudDrawer>
  </div>
</template>

<script>
  export default {
    title: '3.多层抽屉 ',
    subTitle: '在抽屉内打开新的抽屉，用以解决多分支任务的复杂状况。',
    data () {
      return {
        visible: false,
        childrenDrawer: false,
      }
    },
    methods: {
      showDrawer () {
        this.visible = true;
      },
      onClose () {
        this.visible = false;
      },
      showChildrenDrawer () {
        this.childrenDrawer = true;
      },
      onChildrenDrawerClose () {
        this.childrenDrawer = false;
      },
    }
  }
</script>

<style lang="scss">
</style>